home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / xcmd / sprtxtrn.sea / Support Tools eXternals 1.2.5 / card_32604.txt < prev    next >
Text File  |  1990-11-13  |  4KB  |  151 lines

  1. -- card: 32604 from stack: in.5
  2. -- bmap block id: 6623
  3. -- flags: 0000
  4. -- background id: 3858
  5. -- name: PlotFinderICN
  6. ----- HyperTalk script -----
  7. on HideObjects
  8.   hide cd fld "label 1"
  9.   hide cd fld "label 2"
  10.   hide cd btn "Try It!"
  11.   ClearCardArt
  12. end HideObjects
  13.  
  14. on ShowObjects
  15.   show cd fld "label 1"
  16.   show cd fld "label 2"
  17.   show cd btn "Try It!"
  18. end ShowObjects
  19.  
  20. on ClearCardArt
  21.   choose Select Tool
  22.   drag from 70,130 to 220,285
  23.   doMenu "clear picture"
  24.   choose browse tool
  25. end ClearCardArt
  26.  
  27.  
  28.  
  29. -- part 1 (button)
  30. -- low flags: 00
  31. -- high flags: A002
  32. -- rect: left=82 top=300 right=334 bottom=175
  33. -- title width / last selected line: 0
  34. -- icon id / first selected line: 0 / 0
  35. -- text alignment: 1
  36. -- font id: 0
  37. -- text size: 12
  38. -- style flags: 8192
  39. -- line height: 16
  40. -- part name: Try it!
  41. ----- HyperTalk script -----
  42. on mouseUp
  43.   global errGlobal
  44.   put FilePath("", "Choose a file please.") into fileName
  45.   if fileName = empty then exit mouseUp
  46.   put char 1 to OffSet(":", fileName) of fileName into volName
  47.   put FileCreator(fileName, "nodialog:errGlobal") into fCreator
  48.   if errGlobal Γëá empty then
  49.     answer "Error: ΓÇ£" & errGlobal & "ΓÇ¥"
  50.     put empty into errGlobal
  51.     exit mouseUp
  52.   end if
  53.   put FileType(fileName, "nodialog:errGlobal") into fType
  54.   if errGlobal Γëá empty then
  55.     answer errGlobal
  56.     put empty into errGlobal
  57.     exit mouseUp
  58.   end if
  59.   ClearCardArt
  60.   repeat with rowNdx = 1 to 3
  61.     repeat with colNdx = 0 to 1
  62.       put 80 + (rowNdx * 53) into Y
  63.       put 80 + (colNdx * 85) into X
  64.       put X & "," & Y into destPt
  65.       put rowNdx * 2 - 1 + colNdx into theMode
  66.       DsktpICN fCreator,fType,destPt,theMode,volName,"nodialog:errGlobal"
  67.       -- PlotFinderICN fCreator,fType,destPt,theMode,volName,"nodialog:errGlobal"
  68.       if errGlobal Γëá empty then
  69.         answer errGlobal
  70.         put empty into errGlobal
  71.       end if
  72.     end repeat  -- columns
  73.   end repeat   -- rows
  74. end mouseUp
  75.  
  76.  
  77.  
  78.  
  79. -- part 8 (field)
  80. -- low flags: 00
  81. -- high flags: 0000
  82. -- rect: left=24 top=116 right=131 bottom=244
  83. -- title width / last selected line: 0
  84. -- icon id / first selected line: 0 / 0
  85. -- text alignment: 0
  86. -- font id: 3
  87. -- text size: 9
  88. -- style flags: 0
  89. -- line height: 12
  90. -- part name: label 1
  91.  
  92.  
  93. -- part 9 (field)
  94. -- low flags: 00
  95. -- high flags: 0000
  96. -- rect: left=2 top=135 right=293 bottom=71
  97. -- title width / last selected line: 0
  98. -- icon id / first selected line: 0 / 0
  99. -- text alignment: 65535
  100. -- font id: 3
  101. -- text size: 9
  102. -- style flags: 0
  103. -- line height: 11
  104. -- part name: label 2
  105.  
  106.  
  107. -- part contents for background part 38
  108. ----- text -----
  109. 35/50
  110.  
  111. -- part contents for background part 20
  112. ----- text -----
  113.      This XCMD draws a file's ICN# onto the card (an ICN# is the icon that the Finder displays when using "view by icon").  
  114.  
  115.      Calling syntax : DsktpICN Creator,Type,┬½DestPt┬╗,┬½ICNstate┬╗,┬½volumeName┬╗, ┬½nodialog:globalVar┬╗
  116.   CREATOR: a four character file creator signature
  117.   TYPE: a four character file type signature
  118.  ┬½DESTPT┬╗: optional, the upper left corner of the drawing.  Default value is 0,0.
  119. ┬½ICNSTATE┬╗: optional, a number specifying the state of the ICN.  Possible value are:
  120.    1: non-open,non-selected, online
  121.    2: non-open,selected, online
  122.    3: non-open,non-selected, offline
  123.    4: non-open,selected, offline
  124.    5: open,non-selected, online/offline
  125.    6: open,selected, online/offline
  126.  
  127.      Because HyperCard uses so many screen buffers, we can not draw directly to HC's grafPort since our image would probably be erased very quickly.  Thus we convert the ICN into a Picture, copy it to the clipboard, and then paste it onto the card.  This causes whatever was in the clipboard before calling the XCMD to be lost.
  128.  
  129. BEWARE:  This XCMD uses the invisible desktop file to retrieve the icons it needs.  While there is nothing inherently dangerous in doing this, things will change with System 7.0.  The Desktop Manager (currently used by Appleshare file servers) does not use a desktop file and so you will probably get generic icons whenever you call this XCMD and Desktop Manager is running.
  130.  
  131. COMING SOON:  A desktop manager compatible version!
  132.  
  133.  
  134. -- part contents for card part 8
  135. ----- text -----
  136.                 unselected             selected
  137.  
  138. -- part contents for card part 9
  139. ----- text -----
  140.  
  141. non-open
  142. online
  143.  
  144.  
  145. non-open
  146. offline
  147.  
  148.  
  149.  
  150. open
  151. online/offline